<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <meta charset="utf-8">
    <title>执行SQL</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <asset:stylesheet src="layui/css/layui.css"></asset:stylesheet>
    <style>
    .site-h1 {
        padding-bottom: 10px;
        margin-bottom: 20px;
        font-size: 28px;
        font-weight: 300;
        color: #393D49;
        border-bottom: 1px solid #eee;
    }
    .table-th {
        background-color: #abdde5;
        font-weight: bolder;
        text-align: center;
    }
    </style>
</head>

<body>
<div class="site-content">
    <h1 class="site-h1">执行SQL查询语句</h1>

    <fieldset class="layui-elem-field">
        <legend>执行条件</legend>
        <div class="layui-field-box">
            <div class="site-text site-block">
                <form class="layui-form" action="">
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">SQL语句</label>
                        <div class="layui-input-block">
                            <textarea id="sql" name="sql" placeholder="请输入SQL语句" class="layui-textarea"><g:text value="${this.sql}"></g:text></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </fieldset>

    <fieldset class="layui-elem-field">
        <legend>执行结果</legend>
        <div class="layui-field-box">
            <table id="data_table" lay-filter="data_table" cellspacing="0" cellpadding="0" class="layui-table" style="border: 1px solid #e2e2e2;">
                <g:if test="${this.list?.size()>0}">
                    <tr>
                        <g:each var="col" in="${this.list[0]}">
                            <td class="table-th">${col.key}</td>
                        </g:each>
                    </tr>
                </g:if>
                <g:each var="row" in="${this.list}">
                    <tr>
                        <g:each var="col" in="${row}">
                            <td>${col.value}</td>
                        </g:each>

                    </tr>
                </g:each>
            </table>
        </div>
    </fieldset>
</div>
</body>
</html>